WOLF core
WOLF: A Modular Estimation Framework for Robotics
XXXXXXXXXXXXXXXXXXXXXXXXvoid(0)" frameborder="0" name="MSearchResults" id="MSearchResults">
wolf::ProfilingUnit Class Reference

Profiling of a periodic task: number of calls, duration (accumulated, average, max, std dev) and period. More...

#include <core/common/profiling_unit.h>

Public Member Functions

 ProfilingUnit (double desired_period_sec=-1)
 Constructor. More...
 
void startProfiling ()
 Starts the profiling of a call. More...
 
void stopProfiling ()
 Stops the profiling of a call. More...
 
void printProfiling (const std::string &_tabs, std::ostream &stream=std::cout) const
 Prints the profiling results. More...
 
std::string printDuration (double _duration_microsec, int precision=2) const
 Returns a string of a duration (in us) in the most appropriate units with the specified precision. More...
 
void setDesiredPeriod (double _desired_period_sec)
 Sets the desired period in seconds. More...
 
bool isRunning () const
 Returns whether the profiling of a call is running. More...
 
unsigned int getNCallbacks () const
 Returns the number of profiled calls. More...
 
double getDesiredPeriod () const
 Returns the desired period in seconds. More...
 
double getAveragePeriod () const
 Returns the average period in seconds. More...
 
double getAccDuration () const
 Returns the accumulated duration in seconds. More...
 
double getAvgDuration () const
 Returns the average duration in seconds. More...
 
double getMaxDuration () const
 Returns the maximum duration in seconds. More...
 
double getVarDuration () const
 Returns the variance of the duration in seconds squared. More...
 
double getStDevDuration () const
 Returns the standard deviation of the duration in seconds. More...
 

Protected Attributes

bool running_
 True if profiling is running. More...
 
double desired_period_us_
 Desired period in microseconds (< 0 for not specified) More...
 
unsigned int n_callbacks_
 Number of callbacks. More...
 
double average_period_us_
 Average period in microseconds. More...
 
std::chrono::microseconds acc_duration_us_
 Accumulated duration in microseconds. More...
 
std::chrono::microseconds max_duration_us_
 Maximum duration in microseconds. More...
 
double var_duration_us_
 Variance of the duration in microseconds squared. More...
 
std::chrono::time_point< std::chrono::high_resolution_clock > first_clock_
 Time point of the first clock. More...
 
std::chrono::time_point< std::chrono::high_resolution_clock > start_clock_
 Time point of the start clock. More...
 

Detailed Description

Profiling of a periodic task: number of calls, duration (accumulated, average, max, std dev) and period.

Constructor & Destructor Documentation

◆ ProfilingUnit()

wolf::ProfilingUnit::ProfilingUnit ( double  desired_period_sec = -1)

Constructor.

Parameters
desired_period_secDesired period in seconds. Negative value means not specified. Default is -1.

Member Function Documentation

◆ getAccDuration()

double wolf::ProfilingUnit::getAccDuration ( ) const
inline

Returns the accumulated duration in seconds.

◆ getAveragePeriod()

double wolf::ProfilingUnit::getAveragePeriod ( ) const
inline

Returns the average period in seconds.

◆ getAvgDuration()

double wolf::ProfilingUnit::getAvgDuration ( ) const
inline

Returns the average duration in seconds.

◆ getDesiredPeriod()

double wolf::ProfilingUnit::getDesiredPeriod ( ) const
inline

Returns the desired period in seconds.

◆ getMaxDuration()

double wolf::ProfilingUnit::getMaxDuration ( ) const
inline

Returns the maximum duration in seconds.

◆ getNCallbacks()

unsigned int wolf::ProfilingUnit::getNCallbacks ( ) const
inline

Returns the number of profiled calls.

◆ getStDevDuration()

double wolf::ProfilingUnit::getStDevDuration ( ) const
inline

Returns the standard deviation of the duration in seconds.

◆ getVarDuration()

double wolf::ProfilingUnit::getVarDuration ( ) const
inline

Returns the variance of the duration in seconds squared.

◆ isRunning()

bool wolf::ProfilingUnit::isRunning ( ) const
inline

Returns whether the profiling of a call is running.

◆ printDuration()

std::string wolf::ProfilingUnit::printDuration ( double  _duration_microsec,
int  precision = 2 
) const

Returns a string of a duration (in us) in the most appropriate units with the specified precision.

Parameters
_duration_microsecDuration in microseconds.
precisionPrecision for printing the duration. Default is 2.

◆ printProfiling()

void wolf::ProfilingUnit::printProfiling ( const std::string &  _tabs,
std::ostream &  stream = std::cout 
) const

Prints the profiling results.

Parameters
_tabsTabs to be used for indentation.
streamOutput stream to print the results. Default is std::cout.

◆ setDesiredPeriod()

void wolf::ProfilingUnit::setDesiredPeriod ( double  _desired_period_sec)
inline

Sets the desired period in seconds.

◆ startProfiling()

void wolf::ProfilingUnit::startProfiling ( )

Starts the profiling of a call.

◆ stopProfiling()

void wolf::ProfilingUnit::stopProfiling ( )

Stops the profiling of a call.

Member Data Documentation

◆ acc_duration_us_

std::chrono::microseconds wolf::ProfilingUnit::acc_duration_us_
protected

Accumulated duration in microseconds.

◆ average_period_us_

double wolf::ProfilingUnit::average_period_us_
protected

Average period in microseconds.

◆ desired_period_us_

double wolf::ProfilingUnit::desired_period_us_
protected

Desired period in microseconds (< 0 for not specified)

◆ first_clock_

std::chrono::time_point<std::chrono::high_resolution_clock> wolf::ProfilingUnit::first_clock_
protected

Time point of the first clock.

◆ max_duration_us_

std::chrono::microseconds wolf::ProfilingUnit::max_duration_us_
protected

Maximum duration in microseconds.

◆ n_callbacks_

unsigned int wolf::ProfilingUnit::n_callbacks_
protected

Number of callbacks.

◆ running_

bool wolf::ProfilingUnit::running_
protected

True if profiling is running.

◆ start_clock_

std::chrono::time_point<std::chrono::high_resolution_clock> wolf::ProfilingUnit::start_clock_
protected

Time point of the start clock.

◆ var_duration_us_

double wolf::ProfilingUnit::var_duration_us_
protected

Variance of the duration in microseconds squared.


The documentation for this class was generated from the following files: